color chooser: Reset show-editor on unmap
authorMatthias Clasen <mclasen@redhat.com>
Wed, 12 Aug 2015 11:22:05 +0000 (07:22 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 12 Aug 2015 15:29:11 +0000 (11:29 -0400)
We have a testcolorchooser test, with a --edit option. It was
supposed to make the color chooser come up in edit mode, but
it didn't work ever since we dropped the ::response handler.
Fix it by resetting show-editor on unmap, instead of on map.
This way, users can set show-editor before showing the dialog,
and it will take effect.

gtk/gtkcolorchooserdialog.c

index 176f9390729168f13c7da385e816b86da80f9240..fdedc8786c147e2a19066ec47117f85e9c094b85 100644 (file)
@@ -119,16 +119,14 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 static void
-gtk_color_chooser_dialog_map (GtkWidget *widget)
+gtk_color_chooser_dialog_unmap (GtkWidget *widget)
 {
+  GTK_WIDGET_CLASS (gtk_color_chooser_dialog_parent_class)->unmap (widget);
+
   /* We never want the dialog to come up with the editor,
    * even if it was showing the editor the last time it was used.
    */
-  g_object_set (GTK_COLOR_CHOOSER_DIALOG (widget)->priv->chooser,
-                "show-editor", FALSE,
-                NULL);
-
-  GTK_WIDGET_CLASS (gtk_color_chooser_dialog_parent_class)->map (widget);
+  g_object_set (widget, "show-editor", FALSE, NULL);
 }
 
 static void
@@ -207,7 +205,7 @@ gtk_color_chooser_dialog_class_init (GtkColorChooserDialogClass *class)
   object_class->get_property = gtk_color_chooser_dialog_get_property;
   object_class->set_property = gtk_color_chooser_dialog_set_property;
 
-  widget_class->map = gtk_color_chooser_dialog_map;
+  widget_class->unmap = gtk_color_chooser_dialog_unmap;
 
   g_object_class_override_property (object_class, PROP_RGBA, "rgba");
   g_object_class_override_property (object_class, PROP_USE_ALPHA, "use-alpha");